﻿#PowerShell


#Site
Backup-SPSite -Identity SiteCollectionURLHere -Path BackupFilePathHere #[-Force] [-NoSiteLock] [-UseSqlSnapshot] [-Verbose]
Restore-SPSite -Identity SiteCollectionURLHere -Path BackupFilePathHere #[-DatabaseServer DatabaseServerNameHere] [-DatabaseName ContentDatabaseNameHere] [-HostHeader HostHeaderHere] [-Force] [-GradualDelete] [-Verbose]

#Farm
Backup-SPFarm -BackupMethod Differential -Directory \\MyServer\SPBackups
Backup-SPFarm -BackupMethod Full -Directory \\MyServer\SPBackups

Restore-SPFarm -Directory \\MyServer\SPBackups -RestoreMethod Overwrite #[-BackupId <GUID>]


# STSADM

#A full farm backup followed by a restore:
stsadm -o backup -url http://app01/ -directory \\app01\sharepointbackups -BackupMethod Full -Quiet 
stsadm -o restore -url http://app01/ -filename \\app01\sharepointbackups –Overwrite

#Back up and restore configuration information only:
stsadm -o backup -url http://app01 -directory \\app01\sharepointbackups -configurationonly -quiet 
stsadm -o restore -url http://app01 -filename \\app01\sharepointbackups -configurationonly –quiet

#Back up and restore a service application:
stsadm -o backup -directory \\app01\sharepointbackups -quiet -backupmethod full -item "Excel Services" 
stsadm -o restore -directory \\app01\sharepointbackups -item "Excel Services" –quiet

#Back up and restore a site collection: 
stsadm -o backup -url http://app01/portalsitecollection -filename \\app01\SharePointBackups\portalsitecollection.bak -overwrite 
stsadm -o restore -url http://app01/portalsitecollection -filename \\app01\SharePointBackups\portalsitecollection.bak –overwrite

#Export and import a subsite, list, or library:
stsadm -o export –url http://app01/sites/portal/documents –filename \\app01\sharepointbackups\SD.bak -quiet -overwrite 
stsadm -o import –url http://app01/sites/portal/documents –filename \\app01\sharepointbackups\SD.bak -quiet